<?php
require_once("Config.php");
require_once("User.php");
require_once("MsgStack.php");
session_start();
$message ="";
if($_GET['action']=="update"){
  $updateSql= "update user set username='".$_POST['username']."',password='".$_POST['password']."'";
  $update = mysql_query($updateSql);
  if($update){
    $message = "Update user account info successful!";
  }else{
    $message = "Update user account info failure!";
  }
  
}






$qSql = "Select * From user where id=1";
$user = new User();
$rs = mysql_query($qSql);

while($row=mysql_fetch_array($rs)){
  $user->setUsername($row['username']);
  $user->setPassword($row['password']);
  
}

?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>
      Welcome!
    </title>
    <link href="css/admin-common.css" rel="stylesheet" type="text/css">
    <link type="text/css" href="css/ui-lightness/jquery-ui-1.7.3.custom.css" rel="stylesheet" />
    <script type="text/javascript" src="../js/jquery.js">
    </script>
    <script type="text/javascript" src="js/common.js"></script>
      <script type="text/javascript" src="js/jquery-ui-1.7.3.custom.min.js"></script>
  
  </head>
  <script type="text/javascript">
    var app={
        init: function() {
        }
      }
      </script>
      <body>
      <p>
      <?php echo $message;?>
      </p>
      <div id="#validFailureDlg" style="display:none">
        Username and Password are all required!
      </div>
      <h3>User Management</h3>
    <hr/>
   <strong style="color:#C92C24;clear:both; display:block"> Notice:Please keep your account info in mind after you update them!!!</strong>
    
  
  <form action="?action=update" method="post">
 <p> <label>
    <span>username</span><input type="text" id="username" name="username" value='<?php echo $user->getUsername(); ?>' />
    </label>
    
    <label>
    <span>password</span><input type="text" id="password" name="password" value='<?php echo $user->getpassword(); ?>' />
    </label>
    </p>
    <p>
    <input type="submit" value="update"/>
    </p>
    </form>
    
      </body>
      </html>